const reScreenSize = (wid) => {
  const designWidth = 1280;//设计稿的宽度，根据实际项目调整
  const designHeight = 720;//设计稿的高度，根据实际项目调整
  const baseSize = 10
  let pcW = document.documentElement.clientWidth; // 获取设备的宽度
  let pcH = document.documentElement.clientHeight; // 获取设备的宽度

  // 当设备宽度小于1400px时，不在改变rem的值
  if (pcW <= 1300) return;
  let fontSize =
    pcW / pcH < designWidth / designHeight ?
      (pcW / designWidth) * baseSize :
      (pcH / designHeight) * baseSize
  document.documentElement.style.fontSize = fontSize + 'px';
};

reScreenSize();
window.addEventListener('load', reScreenSize);
window.addEventListener('resize', () => reScreenSize(document.documentElement.clientWidth));
